/*
 * TabAddition.cpp
 *
 *  Created on: 9 déc. 2013
 *      Author: Raphaël
 */

#include "AddThread.h"

using namespace raph;
using namespace raph::type;

AddThread::AddThread(const std::vector<T_FLOAT128>& vecA, const std::vector<T_FLOAT128>& vecB,
        const std::shared_ptr<T_FLOAT128>& ptrTabResult, const T_INT64& N,
        const T_INT64& startPosition) :
        m_vecA(vecA), m_vecB(vecB), m_ptrTabResult(ptrTabResult), m_N(N), m_startPosition(
                startPosition)
    {

    }

AddThread::~AddThread()
    {

    }

void AddThread::run()
    {
    for (T_UINT64 position = m_startPosition; position < m_vecA.size(); position += m_N)
        {
        if (auto ptr = m_ptrTabResult.lock())
            {
            ptr.get()[position] = m_vecA[position] + m_vecB[position];
            }
        }
    }
